#!/usr/bin/env php
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | AuthorModel: yunwuxin <448901948@qq.com>
// +----------------------------------------------------------------------
// CLI模式
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(-1);
ini_set ( 'date.timezone', 'Asia/Shanghai' );
ini_set("memory_limit", '4096M');
ini_set('default_socket_timeout', -1);
set_time_limit(0);
// 定义环境标识
$argvs = $_SERVER['argv'];
$env = '';
foreach ($argvs as $key => $arg) {
    if ( strpos($arg, 'env') !== false ) {
        list($env) = array_reverse(explode("=", $arg));
    }
}
if(!$env){
    die("not found ENVIRONMENT");
}
define('ENV', $env);

// 获取REQUEST_SCHEME=>http or https
$requestScheme = 'https';

// 定义项目路径
define('APP_PATH', __DIR__ . '/application/');
// 系统名称
define ("SYS_NAME", "c21" );

// 系统HTTP网址路径
define('WEB_HTTP_HOST', "{$requestScheme}://" . '');
// 系统网址路径,不含http
define('WEB_HOST', '');
// 应用HTTP网址路径
define('APP_HTTP_HOST', "{$requestScheme}://" . '');
// 应用网址路径,不含http
define('APP_HOST', '');

// 定义根目录
define("ROOT_PATH", dirname(realpath(APP_PATH)) . DIRECTORY_SEPARATOR);
// Application绝对目录
define("ApplicationPath", dirname(realpath(APP_PATH)) . DIRECTORY_SEPARATOR . "application" . DIRECTORY_SEPARATOR);
// Common 绝对路径
define("CommonPath", ApplicationPath . "common" . DIRECTORY_SEPARATOR);
// 定义配置目录
define("CONF_PATH", ROOT_PATH.'application'.DIRECTORY_SEPARATOR.'common'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR);
// 环境配置目录
define("ENV_CONF_PATH", CONF_PATH.ENV.DIRECTORY_SEPARATOR);
// 加载框架引导文件
require __DIR__.'/thinkphp/console.php';